All Packages Class Hierarchy This Package Previous Next Index
Class java.naming.CompositeName
java.lang.Object
|
+----java.naming.CompositeName
- public class CompositeName
- extends Object
- implements Cloneable, Name
The CompositeName class represents a composite name -- a sequence of
component names spanning multiple namespaces.
Each component is a string name from the namespace of a
naming system. If the component comes from a hierarchical
namespace, that component can be further parsed into
its atomic parts by using the CompoundName class.
The components of a composite name are numbered. The indexes of a
composite name with N components range from 0 up to, but not including, N.
This range may be written as [0,N). An empty composite name has no
components.
-
CompositeName()
- Constructs a new empty composite name.
-
CompositeName(String)
- Constructs a new composite name instance by parsing the string n
using the composite name syntax (left-to-right, slash separated).
-
CompositeName(StringEnumeration)
-
-
appendComponent(String)
- Adds a single component to the end of this composite name.
-
appendName(Name)
- Adds the components of a composite name -- in order -- to the end of
this composite name.
-
clone()
- Generates a copy of this composite name.
-
deleteComponent(int)
- Deletes a component from this composite name.
-
equals(Object)
- Determines whether two composite names are equal.
-
getComponent(int)
- Retrieves a component of this composite name.
-
getComponentCount()
- Retrieves the number of components in this composite name.
-
getComponents()
- Retrieves the components of this composite name as an enumeration
of strings.
-
getPrefix(int)
- Retrieves a composite name whose components consist of a prefix of the
components in this composite name.
-
getSuffix(int)
- Retrieves a composite name whose components consist of a suffix of the
components in this composite name.
-
hashCode()
- Computes the hash code of this composite name.
-
insertComponent(int, String)
- Adds a single component at a specified position within this
composite name.
-
insertName(int, Name)
- Adds the components of a composite name -- in order -- at a specified
position within this composite name.
-
isEmpty()
- Determines whether this composite name is empty.
-
isPrefix(Name)
- Determines whether a composite name is a prefix of this composite name.
-
isSuffix(Name)
- Determines whether a composite name is a suffix of this composite name.
-
prependComponent(String)
- Adds a single component to the start of this composite name.
-
prependName(Name)
- Adds the components of a composite name -- in order -- to the beginning
of this composite name.
-
toString()
- Generates the string representation of this composite name.
CompositeName
protected CompositeName(StringEnumeration comps)
CompositeName
public CompositeName(String n) throws InvalidNameException
- Constructs a new composite name instance by parsing the string n
using the composite name syntax (left-to-right, slash separated).
- Parameters:
- n - The string to parse.
CompositeName
public CompositeName()
- Constructs a new empty composite name.
toString
public String toString()
- Generates the string representation of this composite name.
- Returns:
- A string representation of this composite name.
- Overrides:
- toString in class Object
equals
public boolean equals(Object obj)
- Determines whether two composite names are equal.
Two composite names are equal if each component in one is equal
to the corresponding component in the other.
- Parameters:
- obj - The object to compare against.
- Returns:
- true if obj is equal to this composite name, false otherwise.
- Overrides:
- equals in class Object
hashCode
public int hashCode()
- Computes the hash code of this composite name.
- Returns:
- The hash code computed using characters from this composite
name.
- Overrides:
- hashCode in class Object
clone
public Object clone()
- Generates a copy of this composite name.
- Returns:
- A copy of this composite name.
- Overrides:
- clone in class Object
getComponentCount
public int getComponentCount()
- Retrieves the number of components in this composite name.
- Returns:
- The number of components in this composite name.
isEmpty
public boolean isEmpty()
- Determines whether this composite name is empty.
- Returns:
- true if this composite name is empty, false otherwise.
getComponents
public StringEnumeration getComponents()
- Retrieves the components of this composite name as an enumeration
of strings.
- Returns:
- An enumeration of the components of this composite name.
getComponent
public String getComponent(int posn)
- Retrieves a component of this composite name.
- Parameters:
- posn - The 0-based index of the component to retrieve.
Must be in the range [0,getComponentCount()).
- Returns:
- The component at index posn.
getPrefix
public Name getPrefix(int posn)
- Retrieves a composite name whose components consist of a prefix of the
components in this composite name.
- Parameters:
- posn - The 0-based index of the component at which to stop.
Must be in the range [0,getComponentCount()].
- Returns:
- A composite name consisting of the components at indexes in
the range [0,posn).
getSuffix
public Name getSuffix(int posn)
- Retrieves a composite name whose components consist of a suffix of the
components in this composite name.
- Parameters:
- posn - The 0-based index of the component at which to start.
Must be in the range [0,getComponentCount()].
- Returns:
- A composite name consisting of the components at indexes in
the range [posn,getComponentCount()). If posn is equal to
getComponentCount(), an empty composite name is returned.
isPrefix
public boolean isPrefix(Name n)
- Determines whether a composite name is a prefix of this composite name.
A composite name 'n' is a prefix if it is equal to
getPrefix(n.getComponentCount()).
- Parameters:
- n - The composite name to check.
- Returns:
- true if n is a prefix of this composite name, false otherwise.
isSuffix
public boolean isSuffix(Name n)
- Determines whether a composite name is a suffix of this composite name.
A composite name 'n' is a suffix if it it is equal to
getSuffix(getComponentCount()-n.getComponentCount()).
- Parameters:
- n - The composite name to check.
- Returns:
- true if n is a suffix of this composite name, false otherwise.
prependName
public void prependName(Name prefix) throws InvalidNameException
- Adds the components of a composite name -- in order -- to the beginning
of this composite name.
- Parameters:
- prefix - The components to add.
appendName
public void appendName(Name suffix) throws InvalidNameException
- Adds the components of a composite name -- in order -- to the end of
this composite name.
- Parameters:
- suffix - The components to add.
insertName
public void insertName(int posn,
Name n) throws InvalidNameException
- Adds the components of a composite name -- in order -- at a specified
position within this composite name.
Components of this composite name at or after the index of the first
new component are shifted to accommodate the new components.
- Parameters:
- n - The components to add.
- posn - The index in this name at which to add the new
components. Must be in the range [0,getComponentCount()].
prependComponent
public void prependComponent(String comp) throws InvalidNameException
- Adds a single component to the start of this composite name.
- Parameters:
- comp - The component to add.
appendComponent
public void appendComponent(String comp) throws InvalidNameException
- Adds a single component to the end of this composite name.
- Parameters:
- comp - The component to add.
insertComponent
public void insertComponent(int posn,
String comp)
- Adds a single component at a specified position within this
composite name.
Components of this composite name at or after the index of the new
component are shifted by one to accommodate the new component.
- Parameters:
- comp - The component to add.
- posn - The index at which to add the new component.
Must be in the range [0,getComponentCount()].
deleteComponent
public void deleteComponent(int posn) throws InvalidNameException
- Deletes a component from this composite name.
- Parameters:
- posn - The index of the component to delete.
Must be in the range [0,getComponentCount()].
All Packages Class Hierarchy This Package Previous Next Index